#include "lcd_show.h"

char text[20];

uint8_t keyword[3]={1,2,3};
uint8_t B1_value,B2_value,B3_value;
uint8_t B1_first=1,B2_first=1,B3_first=1;
void psd_show(void)
{
	sprintf(text,"       PSD        ");
	LCD_DisplayStringLine(Line1,(uint8_t *)text);
	
	if(B1_first)
	{
		sprintf(text,"    B1=@       ");
	}else
	sprintf(text,"    B1=%d       ",B1_value);
	LCD_DisplayStringLine(Line3,(uint8_t *)text);
	if(B2_first)
	{
		sprintf(text,"    B2=@       ");
	}else
	sprintf(text,"    B2=%d       ",B2_value);
	LCD_DisplayStringLine(Line4,(uint8_t *)text);
	
	if(B3_first)
	{
		sprintf(text,"    B3=@       ");
	}else
	sprintf(text,"    B3=%d       ",B3_value);
	LCD_DisplayStringLine(Line5,(uint8_t *)text);
	
//	sprintf(text,"    %d  %d %d  ",keyword[0],keyword[1],keyword[2]);
//	LCD_DisplayStringLine(Line7,(uint8_t *)text);
//	

//	LCD_DisplayStringLine(Line8,receive_data);
}

uint16_t fre;
uint8_t duty;
void sta_show(void)
{
	fre=80000000/(TIM2->PSC+1)/100;
	duty=TIM2->CCR2;
	
	sprintf(text,"       PSD        ");
	LCD_DisplayStringLine(Line1,(uint8_t *)text);
	
	sprintf(text,"    F=%dHz     ",fre);
	LCD_DisplayStringLine(Line3,(uint8_t *)text);
	sprintf(text,"    D=%d%%      ",duty);
	LCD_DisplayStringLine(Line4,(uint8_t *)text);
	sprintf(text,"               ");
	LCD_DisplayStringLine(Line5,(uint8_t *)text);
}


void lcd_show(void)
{
	if(lcd_flag==0)
	{
		psd_show();
	}
	else sta_show();
	
}



